import time

# 方法1
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.remote.switch_to import SwitchTo

wd = webdriver.Chrome(service=Service(".\chromedriver_win136.exe"))

wd.get("http://127.0.0.1:5000/elements/")

wd.implicitly_wait(10)

radio_btn1 = wd.find_element(By.CSS_SELECTOR, "#beijing")
time.sleep(3)
radio_btn1.click()
time.sleep(5)
radio_btn1 = wd.find_element(By.CSS_SELECTOR, "#shenzhen")
time.sleep(3)
radio_btn1.click()
time.sleep(5)

check_box1 = wd.find_element(By.CSS_SELECTOR, "#chengdu")
check_box1.click()
time.sleep(5)
check_box2 = wd.find_element(By.CSS_SELECTOR, "#guangzhou")
check_box2.click()
time.sleep(5)
check_box3 = wd.find_element(By.CSS_SELECTOR, "#chongqing")
check_box3.click()
time.sleep(5)
print(check_box3.is_selected())  # 判断是否被选中，返回True或False
